package com.knight.common.constant;

import java.util.HashMap;
import java.util.Map;

import com.jfinal.kit.PropKit;

public class Constant {

	public static final String STATIC_RESOURCE_VERSION = PropKit.get("staticResourceVersion");

	/**
	 * web资源路径
	 */
	public static final String WEB_RESOURSE_URL = PropKit.get("webResourceUrl");

	/**
	 * json相应常量
	 * 
	 * @author YQ
	 *
	 */
	public interface JsonConstant {
		public final static String SUCCESS_SUCCESS = "0";
		public final static String SUCCESS_ERROR = "1";

	}

	/**
	 * 相关符号
	 * 
	 * @author YQ
	 *
	 */
	public interface Symbo {
		public final static String COMMA = ",";
		public final static String CONNECTION = "-";
		public final static String SEMICOLON = ":";
	}

	/**
	 * 编码格式
	 * 
	 * @author YQ
	 *
	 */
	public interface EnCodeFormat {
		public final static String UTF8 = "UTF-8";
	}

	/**
	 * 异常信息
	 * 
	 * @author YQ
	 *
	 */
	public interface ExceptionMessage {
		public final static String REQUEST_PARAMETER_FORMAT_ERROR = "请求参数格式错误";

		public final static String REQUEST_PARAMETER_EXCEPTION = "请求参数异常";

		public final static String PARAMETER_IS_NULL = "参数为空";
	}

	/**
	 * 菜单类型
	 * 
	 * @author YQ
	 *
	 */
	public interface MenuTypes {
		/** 一级菜单 **/
		public final static String LEVEL_ONE_MENU = "1";
		/** 二级菜单 **/
		public final static String LEVEL_TWO_MENU = "2";
		/**
		 * 菜单状态-启用
		 */
		public final static String MENU_STATUS_USE = "1";
		/**
		 * 菜单状态-禁用
		 */
		public final static String MENU_STATUS_DISABLED = "0";
	}

	public interface ParentMenuId {
		public final static String INDEX_ID = "00001";
		public final static String ABOUT_ID = "00002";
		public final static String NEWS_ID = "00003";
		public final static String HONORS_ID = "00004";
		public final static String PROJECTS_ID = "00005";
		public final static String SERVICEFLOW_ID = "00006";
		public final static String CUSTOMERMESSAGE_ID = "00007";
		public final static String CONTACTUS_ID = "00008";
	}

	public interface TopMenusName {
		public final static String INDEX = "首页";
		public final static String ABOUT = "关于我们";
		public final static String NEWS = "新闻中心";
		public final static String HONORS = "资质荣誉";
		public final static String PROJECTS = "工程案例";
		public final static String SERVICEFLOW = "服务流程";
		public final static String CUSTOMERMESSAGE = "客户留言";
		public final static String CONTACTUS = "联系我们";

		public final static String INDEX_URL = "/";
		public final static String ABOUT_URL = "/about";
		public final static String NEWS_URL = "/news";
		public final static String HONORS_URL = "/shidaifong";
		public final static String PROJECTS_URL = "/projects";
		public final static String SERVICEFLOW_URL = "/serviceflow";
		public final static String CUSTOMERMESSAGE_URL = "/customermessage";
		public final static String CONTACTUS_URL = "/contactus";
	}

	public static Map<String, String> getServieFlow() {
		String values = PropKit.get("servieFlow");
		String arr[] = values.split(Constant.Symbo.COMMA);
		Map<String, String> map = new HashMap<>();
		for (String str : arr) {
			String[] tmp = str.split(Constant.Symbo.SEMICOLON);
			map.put(tmp[0], tmp[1]);
		}
		return map;
	}
}
